import request from '@/utils/request'


// 新增平台
export function createPlatform(data) {
  return request({
    url: '/platform/platforms/',
    method: 'post',
    data
  })
}

// 删除平台
export function deletePlatform(id) {
  return request({
    url: `/platform/platforms/${id}/`,
    method: 'delete'
  })
}
// 修改平台
export function updatePlatform(id, data) {
  return request({
    url: `/platform/platforms/${id}/`,
    method: 'put',
    data
  })
}

// 获取平台列表
export function getPlatforms(data) {
  return request({
    url: '/platform/platforms/',
    method: 'get',
    params: data
  })
}


// 获取平台详情
export function getPlatform(id) {
  return request({
    url: `/platform/platforms/${id}/`,
    method: 'get'
  })
}

// 新增平台账号
export function createPlatformAccount(data) {
  return request({
    url: '/platform/account/',
    method: 'post',
    data
  })
}

// 删除平台账号
export function deletePlatformAccount(id) {
  return request({
    url: `/platform/account/${id}/`,
    method: 'delete'
  })
}
// 修改平台账号
export function updatePlatformAccount(id, data) {
  return request({
    url: `/platform/account/${id}/`,
    method: 'put',
    data
  })
}

// 获取平台账号列表
export function getPlatformAccounts(data) {
  return request({
    url: '/platform/account/',
    method: 'get',
    params: data
  })
}


// 获取平台账号详情
export function getPlatformAccount(id) {
  return request({
    url: `/platform/account/${id}/`,
    method: 'get'
  })
}